// components/custom-tab-bar/index.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {

    },

    /**
     * 组件的初始数据
     */
    data: {
        active:0,
        list: [
          {
            "pagePath": "/pages/index/index",
            "text": "首页",
            iconPath:"home-o",
            selectedIconPath:"home"
            },
            {
              "pagePath": "/pages/start/start",
              "text": "收藏",
              iconPath:"like-o",
              selectedIconPath:"like",
            },
            {
              "pagePath": "/pages/dinner/dinner",
              "text": "餐品",
              iconPath:"bag-o",
              selectedIconPath:"bag",
            },
            {
              "pagePath": "/pages/profile/profile",
              "text": "我的",
              iconPath:"user-circle-o",
              selectedIconPath:"user-circle",
            }
        ]
    },

    /**
     * 组件的方法列表
     */
    methods: {
        onChange(e){
            const index = e.detail
            const url = this.data.list[e.detail].pagePath
            this.setData({
              active:index
          })
          wx.switchTab({url})
        }
    }
})
